curl --request POST \
--url https://api.topsort.com/toptimize/v1/rank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ranking": [
{
"type": "listings",
"slots": 3,
"pageSize": 3,
"page": {
"type": "category",
"value": "sneakers",
"pageId": "/category/sneakers"
},
"opaqueUserId": "u_9ske45"
}
]
}
'{
"results": [
{
"resultType": "listings",
"results": [],
"error": false
}
]
}⚠️ Beta Access Required
Contact your sales representative to gain access to this endpoint and start using it.
Use the /ranking endpoint to re-rank objects to show on a page. This endpoint can retrieve sponsored
and non-sonsored objects and rank them together, according to an appropriate context and behavior information.
curl --request POST \
--url https://api.topsort.com/toptimize/v1/rank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ranking": [
{
"type": "listings",
"slots": 3,
"pageSize": 3,
"page": {
"type": "category",
"value": "sneakers",
"pageId": "/category/sneakers"
},
"opaqueUserId": "u_9ske45"
}
]
}
'{
"results": [
{
"resultType": "listings",
"results": [],
"error": false
}
]
}A valid API key generated in Topsort's UI.
The context information to get the ranking, to rank organic and sponsored products.
1 - 5 elementsShow child attributes
Type of object to be ranked
listings Specifies the maximum number of ranked objects that should be returned.
x >= 1Specifies the maximum number of ranked objects per page that should be returned.
x >= 1Information about the page where an auction or event occurs.
The opaque user ID is an anonymized unique identifier that maps to the original user ID without revealing the original value. This identifier allows Topsort to correlate user activity between auctions and user interactions, independent of the user's logged-in status. For apps or sites where users might interact while logged out, we recommend generating a random identifier (UUIDv7) on the first load, storing it on local storage (cookie, local storage, etc), and letting it live for at least a year. Otherwise, if your users are always logged in for interactions, you may use a hash of your customer ID. Correct purchase attribution requires long-lived opaque user IDs consistent between auction and event requests.
Represents one or more categories for auction targeting. Can be a single category, multiple categories, or category disjunctions.
Show child attributes
The category ID of the bids that will participate in an auction.
1The device for which the ads are meant for.
desktop, mobile List of products for the purpose of running an auction.
Show child attributes
An array of product IDs that should participate in the auction. We recommend sending no more than 500 products per auction.
1 - 10000 elementsThe marketplace's ID of a product which will participate in the auction. These ID must match those in the catalog integration with Topsort.
1An array of marketplace defined quality scores, each corresponding to the product ID with matching array index.
If given, these values will be combined with our internal quality scores to provide a score
that better represents the relevance of the participating products.
Note that the length of this array must be the same as the length of the ids array and
that the values must be between 0 and 1.
1 - 10000 elementsx <= 1[
{
"type": "listings",
"slots": 3,
"pageSize": 3,
"page": {
"type": "category",
"value": "sneakers",
"pageId": "/category/sneakers"
},
"opaqueUserId": "u_9ske45"
}
]The ranking results. The list of winners will contain at most slots entries per auction. It may contain fewer or no entries at all if there aren't enough products to fill the slots.
1 - 5 elementsShow child attributes
Array of ranking objects in order from highest to lowest relevancy.
Show child attributes
Where is the product ranked in the auction.
x >= 1The target type of the winning bid.
organic, sponsored The marketplace's ID of the ranked entity.
An opaque Topsort ID to be used when this item is ranked or interacted with.
A boolean indicating whether this auction was resolved successfully.
[
{
"resultType": "listings",
"results": [],
"error": false
}
]Was this page helpful?